﻿//-----------------------------------------------------------------------------------------
// <copyright file="R2VS.cs" company="Jakub Florczyk (www.jakubflorczyk.pl)">
//      Copyright © 2009 Jakub Florczyk (www.jakubflorczyk.pl)
//      http://samsungmobilesdknet.codeplex.com
// </copyright>
//-----------------------------------------------------------------------------------------

namespace SamsungMobileSDKNET
{
    using System.Runtime.InteropServices;

    /// <summary>
    /// Specifies error codes specific to the R2VS API.
    /// </summary>
    public enum R2VSResultCode
    {
        /// <summary>
        /// Headset not present.
        /// </summary>
        HeadsetNotPresent = ResultCode.R2VSResultBase
    }

    /// <summary>
    /// R2VS operating modes.
    /// </summary>
    public enum R2VSMode
    {
        /// <summary>
        /// Operating mode none.
        /// </summary>
        None,

        /// <summary>
        /// Operating mode 3D sound
        /// </summary>
        Sound3D,

        /// <summary>
        /// Operating mode M-Theater.
        /// </summary>
        MTheater
    }

    /// <summary>
    /// R2VS 3D Sound modes.
    /// </summary>
    public enum R2VS3DSoundMode
    {
        /// <summary>
        /// Wide mode.
        /// </summary>
        Wide,

        /// <summary>
        /// Dynamic mode.
        /// </summary>
        Dynamic,

        /// <summary>
        /// Surround mode.
        /// </summary>
        Surround
    }

    /// <summary>
    /// R2VS 3D Sound Equalizer presets.
    /// </summary>
    public enum R2VS3DSoundEqualizerPreset
    {
        /// <summary>
        /// Default preset.
        /// </summary>
        Default,

        /// <summary>
        /// Rock preset.
        /// </summary>
        Rock,

        /// <summary>
        /// Full bass preset.
        /// </summary>
        FullBass,

        /// <summary>
        /// Full bass and treble preset.
        /// </summary>
        FullBassAndTreble,

        /// <summary>
        /// Live preset.
        /// </summary>
        Live,

        /// <summary>
        /// Dance preset.
        /// </summary>
        Dance,

        /// <summary>
        /// Pop preset.
        /// </summary>
        Pop,

        /// <summary>
        /// Full treble preset.
        /// </summary>
        FullTreble,

        /// <summary>
        /// Club preset.
        /// </summary>
        Club,

        /// <summary>
        /// Party preset.
        /// </summary>
        Party,

        /// <summary>
        /// Large hall preset.
        /// </summary>
        LargeHall,

        /// <summary>
        /// Soft preset.
        /// </summary>
        Soft,

        /// <summary>
        /// Soft rock preset.
        /// </summary>
        SoftRock
    }

    /// <summary>
    /// R2VS M-Theater processing modes.
    /// </summary>
    public enum R2VSMTheaterMode
    {
        /// <summary>
        /// Clockwise mode.
        /// </summary>
        Clockwise = 1,

        /// <summary>
        /// Counter clockwise mode.
        /// </summary>
        CounterClockwise,

        /// <summary>
        /// Front panning mode.
        /// </summary>
        FrontPanning,

        /// <summary>
        /// Random mode.
        /// </summary>
        Random,

        /// <summary>
        /// Normal mode.
        /// </summary>
        Normal,

        /// <summary>
        /// Front mode.
        /// </summary>
        Front,

        /// <summary>
        /// Back mode.
        /// </summary>
        Back,

        /// <summary>
        /// Mono mode.
        /// </summary>
        Mono,

        /// <summary>
        /// Stereo mode.
        /// </summary>
        Stereo
    }

    /// <summary>
    /// Specifies settings for the R2VS 3D Sound mode.
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct R2VS3DSoundSettings
    {
        /// <summary>
        /// The 3D Sound processing mode.
        /// </summary>
        public R2VS3DSoundMode Mode;

        /// <summary>
        /// The degree to which audio is processed, in percent (1-100), with higher numbers signifying a larger amount of 3D effect.
        /// </summary>
        public uint GainLevel;

        /// <summary>
        /// The 3D Sound mode's equalizer preset setting.
        /// </summary>
        public R2VS3DSoundEqualizerPreset Equalizer;
    }

    /// <summary>
    /// Specifies settings for the R2VS M-Theater processing mode.
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct R2VSMTheaterSettings
    {
        /// <summary>
        /// The M-Theater processing mode.
        /// </summary>
        public R2VSMTheaterMode Mode;

        /// <summary>
        /// The degree to which audio is processed, in percent (1-100), with higher numbers signifying a larger amount of M-Theater effect.
        /// </summary>
        public uint GainLevel;
    }

    /// <summary>
    /// Samsung R2VS API.
    /// </summary>
    /// <remarks>
    /// R2VS is an audio processing system that enhances a phone's audio output by augmenting the sound reproduction quality of an audio source to enrich a user's audio experience.
    /// <br/>
    /// One example of such a system is to simulate the true (physical) surround sound experience while using headphones. 
    /// </remarks>
    public class R2VS
    {
        /// <summary>
        /// Sets the R2VS operating mode.
        /// </summary>
        /// <param name="mode">R2VS mode.</param>
        /// <returns>
        /// <see cref="F:SamsungMobileSDKNET.ResultCode.Success"/> on success
        /// <br/>
        /// <see cref="F:SamsungMobileSDKNET.ResultCode.ErrorInvalidParameter"/> if the input parameter is invalid
        /// <br/>
        /// <see cref="F:SamsungMobileSDKNET.ResultCode.ErrorDeviceNotFound"/> if the device is not present or supported
        /// <br/>
        /// <see cref="F:SamsungMobileSDKNET.ResultCode.ErrorUnknown"/> for all other failures
        /// </returns>
        [DllImport(Common.DllName, EntryPoint = "SmiR2VSSetMode")]
        public static extern ResultCode SetMode(
            [In] R2VSMode mode);

        /// <summary>
        /// Gets the current R2VS operating mode.
        /// </summary>
        /// <param name="mode">Current R2VS mode.</param>
        /// <returns>
        /// <see cref="F:SamsungMobileSDKNET.ResultCode.Success"/> on success
        /// <br/>
        /// <see cref="F:SamsungMobileSDKNET.ResultCode.ErrorInvalidParameter"/> if the input parameter is NULL
        /// <br/>
        /// <see cref="F:SamsungMobileSDKNET.ResultCode.ErrorDeviceNotFound"/> if the device is not present or supported
        /// <br/>
        /// <see cref="F:SamsungMobileSDKNET.ResultCode.ErrorUnknown"/> for all other failures 
        /// </returns>
        [DllImport(Common.DllName, EntryPoint = "SmiR2VSGetMode")]
        public static extern ResultCode GetMode(
            [Out] out R2VSMode mode);

        /// <summary>
        /// Sets the R2VS 3D Sound settings.
        /// </summary>
        /// <param name="settings">R2VS 3D Sound settings.</param>
        /// <returns>
        /// <see cref="F:SamsungMobileSDKNET.ResultCode.Success"/> on success
        /// <br/>
        /// <see cref="F:SamsungMobileSDKNET.ResultCode.ErrorInvalidParameter"/> if the input parameter is invalid
        /// <br/>
        /// <see cref="F:SamsungMobileSDKNET.ResultCode.ErrorDeviceNotFound"/> if the device is not present or supported
        /// <br/>
        /// <see cref="F:SamsungMobileSDKNET.ResultCode.ErrorUnknown"/> for all other failures 
        /// </returns>
        [DllImport(Common.DllName, EntryPoint = "SmiR2VSSet3DSoundSettings")]
        public static extern ResultCode Set3DSoundSettings(
            [In] R2VS3DSoundSettings settings);

        /// <summary>
        /// Gets the current R2VS 3D Sound settings.
        /// </summary>
        /// <param name="settings">Pointer to the current R2VS 3D Sound Settings. </param>
        /// <returns>
        /// <see cref="F:SamsungMobileSDKNET.ResultCode.Success"/> on success
        /// <br/>
        /// <see cref="F:SamsungMobileSDKNET.ResultCode.ErrorInvalidParameter"/> if the input parameter is NULL
        /// <br/>
        /// <see cref="F:SamsungMobileSDKNET.ResultCode.ErrorDeviceNotFound"/> if the device is not present or supported
        /// <br/>
        /// <see cref="F:SamsungMobileSDKNET.ResultCode.ErrorUnknown"/> for all other failures 
        /// </returns>
        [DllImport(Common.DllName, EntryPoint = "SmiR2VSGet3DSoundSettings")]
        public static extern ResultCode Get3DSoundSettings(
            [Out] out R2VS3DSoundSettings settings);

        /// <summary>
        /// Sets the R2VS M-Theater settings.
        /// </summary>
        /// <param name="settings">R2VS MTheater Settings.</param>
        /// <returns>
        /// <see cref="F:SamsungMobileSDKNET.ResultCode.Success"/> on success
        /// <br/>
        /// <see cref="F:SamsungMobileSDKNET.ResultCode.ErrorInvalidParameter"/> if the input parameter is invalid
        /// <br/>
        /// <see cref="F:SamsungMobileSDKNET.ResultCode.ErrorDeviceNotFound"/> if the device is not present or supported
        /// <br/>
        /// <see cref="F:SamsungMobileSDKNET.ResultCode.ErrorUnknown"/> for all other failures 
        /// </returns>
        [DllImport(Common.DllName, EntryPoint = "SmiR2VSSetMTheaterSettings")]
        public static extern ResultCode SetMTheaterSettings(
            [In] R2VSMTheaterSettings settings);

        /// <summary>
        /// Gets the R2VS current M-Theater settings.
        /// </summary>
        /// <param name="settings">Current R2VS M-Theater Settings.</param>
        /// <returns>
        /// <see cref="F:SamsungMobileSDKNET.ResultCode.Success"/> on success
        /// <br/>
        /// <see cref="F:SamsungMobileSDKNET.ResultCode.ErrorInvalidParameter"/> if the input parameter is NULL
        /// <br/>
        /// <see cref="F:SamsungMobileSDKNET.ResultCode.ErrorDeviceNotFound"/> if the device is not present or supported
        /// <br/>
        /// <see cref="F:SamsungMobileSDKNET.ResultCode.ErrorUnknown"/> for all other failures 
        /// </returns>
        [DllImport(Common.DllName, EntryPoint = "SmiR2VSGetMTheaterSettings")]
        public static extern ResultCode GetMTheaterSettings(
            [Out] out R2VSMTheaterSettings settings);              
    }
}
